Skip to content

Commit 58e6487

Browse files
author
Mike Chu
committed
Lint fixes
1 parent c4f9e9e commit 58e6487

File tree

5 files changed

+122
-120
lines changed

5 files changed

+122
-120
lines changed

.devcontainer/devcontainer.json

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
{
2-
"name": "React SDK",
3-
4-
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-18-bullseye",
5-
6-
"postCreateCommand": "npm install -g npm && yarn install",
7-
8-
"customizations": {
9-
"vscode": {
10-
"extensions": [
11-
"dbaeumer.vscode-eslint",
12-
"eamodio.gitlens",
13-
"esbenp.prettier-vscode",
14-
"Gruntfuggly.todo-tree",
15-
"github.vscode-github-actions",
16-
"Orta.vscode-jest",
17-
"ms-vscode.test-adapter-converter"
18-
],
19-
"settings": {
20-
"files.eol": "\n"
21-
}
22-
}
23-
}
2+
"name": "React SDK",
3+
4+
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-18-bullseye",
5+
6+
"postCreateCommand": "npm install -g npm && yarn install",
7+
8+
"customizations": {
9+
"vscode": {
10+
"extensions": [
11+
"dbaeumer.vscode-eslint",
12+
"eamodio.gitlens",
13+
"esbenp.prettier-vscode",
14+
"Gruntfuggly.todo-tree",
15+
"github.vscode-github-actions",
16+
"Orta.vscode-jest",
17+
"ms-vscode.test-adapter-converter"
18+
],
19+
"settings": {
20+
"files.eol": "\n"
21+
}
22+
}
2423
}
25-
24+
}

.vscode/settings.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
2-
"jest.autoRun": {
3-
"onStartup": [
4-
"all-tests"
5-
]
6-
},
7-
"jest.jestCommandLine": "./node_modules/.bin/jest",
8-
"jest.autoRevealOutput": "on-exec-error"
2+
"jest.autoRun": {
3+
"onStartup": ["all-tests"]
4+
},
5+
"jest.jestCommandLine": "./node_modules/.bin/jest",
6+
"jest.autoRevealOutput": "on-exec-error"
97
}

scripts/build.js

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
2-
* Copyright 2019, Optimizely
2+
* Copyright 2019, 2023 Optimizely
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,34 +14,35 @@
1414
* limitations under the License.
1515
*/
1616

17-
const fs = require("fs");
18-
const path = require("path");
19-
const execSync = require("child_process").execSync;
17+
const path = require('path');
18+
const execSync = require('child_process').execSync;
2019

21-
process.chdir(path.resolve(__dirname, ".."));
20+
process.chdir(path.resolve(__dirname, '..'));
2221

2322
function exec(command, extraEnv) {
2423
return execSync(command, {
25-
stdio: "inherit",
26-
env: Object.assign({}, process.env, extraEnv)
24+
stdio: 'inherit',
25+
env: Object.assign({}, process.env, extraEnv),
2726
});
2827
}
2928

3029
const packageName = 'react-sdk';
31-
const umdName = 'optimizelyReactSdk'
32-
33-
console.log("\nBuilding ES modules...");
30+
const umdName = 'optimizelyReactSdk';
3431

32+
console.log('\nBuilding ES modules...');
3533
exec(`./node_modules/.bin/rollup -c scripts/config.js -f es -o dist/${packageName}.es.js`);
3634

37-
console.log("\nBuilding CommonJS modules...");
38-
35+
console.log('\nBuilding CommonJS modules...');
3936
exec(`./node_modules/.bin/rollup -c scripts/config.js -f cjs -o dist/${packageName}.js`);
4037

41-
console.log("\nBuilding UMD modules...");
42-
43-
exec(`./node_modules/.bin/rollup -c scripts/config.js -f umd -o dist/${packageName}.umd.js --name ${umdName}`, {EXTERNALS: 'forBrowsers', BUILD_ENV: 'production' });
44-
45-
console.log("\nBuilding SystemJS modules...");
46-
47-
exec(`./node_modules/.bin/rollup -c scripts/config.js -f system -o dist/${packageName}.system.js`, {EXTERNALS: 'forBrowsers', BUILD_ENV: 'production' });
38+
console.log('\nBuilding UMD modules...');
39+
exec(`./node_modules/.bin/rollup -c scripts/config.js -f umd -o dist/${packageName}.umd.js --name ${umdName}`, {
40+
EXTERNALS: 'forBrowsers',
41+
BUILD_ENV: 'production',
42+
});
43+
44+
console.log('\nBuilding SystemJS modules...');
45+
exec(`./node_modules/.bin/rollup -c scripts/config.js -f system -o dist/${packageName}.system.js`, {
46+
EXTERNALS: 'forBrowsers',
47+
BUILD_ENV: 'production',
48+
});

scripts/config.js

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
2-
* Copyright 2019, Optimizely
2+
* Copyright 2019, 2023 Optimizely
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,23 +14,22 @@
1414
* limitations under the License.
1515
*/
1616

17-
const typescript = require('rollup-plugin-typescript2')
18-
const commonjs = require('@rollup/plugin-commonjs')
19-
const replace = require('@rollup/plugin-replace')
20-
const { nodeResolve } = require('@rollup/plugin-node-resolve')
21-
const { uglify } = require('rollup-plugin-uglify')
17+
const typescript = require('rollup-plugin-typescript2');
18+
const commonjs = require('@rollup/plugin-commonjs');
19+
const replace = require('@rollup/plugin-replace');
20+
const { nodeResolve } = require('@rollup/plugin-node-resolve');
21+
const { uglify } = require('rollup-plugin-uglify');
2222

23-
const packageDeps = require('../package.json').dependencies || {}
24-
const packagePeers = require('../package.json').peerDependencies || {}
23+
const packageDeps = require('../package.json').dependencies || {};
24+
const packagePeers = require('../package.json').peerDependencies || {};
2525

2626
function getExternals(externals) {
2727
let externalLibs;
28-
if(externals === 'forBrowsers') {
29-
externalLibs = ['react']
28+
if (externals === 'forBrowsers') {
29+
externalLibs = ['react'];
3030
} else {
31-
externalLibs = (externals === 'peers')
32-
? Object.keys(packagePeers)
33-
: Object.keys(packageDeps).concat(Object.keys(packagePeers))
31+
externalLibs =
32+
externals === 'peers' ? Object.keys(packagePeers) : Object.keys(packageDeps).concat(Object.keys(packagePeers));
3433
}
3534
externalLibs.push('crypto');
3635
return externalLibs;
@@ -40,40 +39,40 @@ function getPlugins(env, externals) {
4039
const plugins = [
4140
nodeResolve({
4241
browser: externals === 'forBrowsers',
43-
preferBuiltins: externals !== 'forBrowsers'
42+
preferBuiltins: externals !== 'forBrowsers',
4443
}),
4544
commonjs({
4645
include: /node_modules/,
4746
}),
48-
]
47+
];
4948

5049
if (env) {
5150
plugins.push(
5251
replace({
5352
'process.env.NODE_ENV': JSON.stringify(env),
54-
}),
55-
)
53+
})
54+
);
5655
}
5756

58-
plugins.push(typescript())
57+
plugins.push(typescript());
5958

6059
if (env === 'production') {
61-
plugins.push(uglify())
60+
plugins.push(uglify());
6261
}
6362

64-
return plugins
63+
return plugins;
6564
}
6665

6766
const config = {
6867
input: 'src/index.ts',
6968
output: {
7069
globals: {
7170
react: 'React',
72-
crypto: 'crypto'
71+
crypto: 'crypto',
7372
},
7473
},
7574
external: getExternals(process.env.EXTERNALS),
7675
plugins: getPlugins(process.env.BUILD_ENV, process.env.EXTERNALS),
77-
}
76+
};
7877

79-
module.exports = config
78+
module.exports = config;

scripts/winbuild.js

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,51 @@
1-
/**
2-
* Copyright 2023, Optimizely
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
17-
const fs = require("fs");
18-
const path = require("path");
19-
const execSync = require("child_process").execSync;
20-
21-
process.chdir(path.resolve(__dirname, ".."));
22-
23-
function exec(command, extraEnv) {
24-
return execSync(command, {
25-
stdio: "inherit",
26-
env: Object.assign({}, process.env, extraEnv)
27-
});
28-
}
29-
30-
const packageName = 'react-sdk';
31-
const umdName = 'optimizelyReactSdk'
32-
33-
console.log("\nBuilding ES modules...");
34-
exec(`.\\node_modules\\.bin\\rollup -c scripts\\config.js -f es -o dist\\${packageName}.es.js`);
35-
36-
console.log("\nBuilding CommonJS modules...");
37-
38-
exec(`.\\node_modules\\.bin\\rollup -c scripts\\config.js -f cjs -o dist\\${packageName}.js`);
39-
40-
console.log("\nBuilding UMD modules...");
41-
42-
exec(`.\\node_modules\\.bin\\rollup -c scripts\\config.js -f umd -o dist\\${packageName}.umd.js --name ${umdName}`, {EXTERNALS: 'forBrowsers', BUILD_ENV: 'production' });
43-
44-
console.log("\nBuilding SystemJS modules...");
45-
46-
exec(`.\\node_modules\\.bin\\rollup -c scripts\\config.js -f system -o dist\\${packageName}.system.js`, {EXTERNALS: 'forBrowsers', BUILD_ENV: 'production' });
1+
/**
2+
* Copyright 2023, Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
const path = require('path');
18+
const execSync = require('child_process').execSync;
19+
20+
process.chdir(path.resolve(__dirname, '..'));
21+
22+
function exec(command, extraEnv) {
23+
return execSync(command, {
24+
stdio: 'inherit',
25+
env: Object.assign({}, process.env, extraEnv),
26+
});
27+
}
28+
29+
const packageName = 'react-sdk';
30+
const umdName = 'optimizelyReactSdk';
31+
32+
console.log('\nBuilding ES modules...');
33+
exec(`.\\node_modules\\.bin\\rollup -c scripts\\config.js -f es -o dist\\${packageName}.es.js`);
34+
35+
console.log('\nBuilding CommonJS modules...');
36+
37+
exec(`.\\node_modules\\.bin\\rollup -c scripts\\config.js -f cjs -o dist\\${packageName}.js`);
38+
39+
console.log('\nBuilding UMD modules...');
40+
41+
exec(`.\\node_modules\\.bin\\rollup -c scripts\\config.js -f umd -o dist\\${packageName}.umd.js --name ${umdName}`, {
42+
EXTERNALS: 'forBrowsers',
43+
BUILD_ENV: 'production',
44+
});
45+
46+
console.log('\nBuilding SystemJS modules...');
47+
48+
exec(`.\\node_modules\\.bin\\rollup -c scripts\\config.js -f system -o dist\\${packageName}.system.js`, {
49+
EXTERNALS: 'forBrowsers',
50+
BUILD_ENV: 'production',
51+
});

0 commit comments

Comments
 (0)