Skip to content

Commit

Permalink
build(folder): update build folder for all projects
Browse files Browse the repository at this point in the history
  • Loading branch information
ph1p committed Jul 29, 2021
1 parent cdeaa57 commit 3b24cda
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 25 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ Figma Chat/
node_modules
*.zip
dist
build
build
release
Binary file modified .yarn/install-state.gz
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "",
"private": true,
"scripts": {
"build": "yarn build:plugin && yarn build:web && yarn build:server",
"start:plugin": "yarn workspace plugin start",
"start:web": "yarn workspace web start",
"start:server": "yarn workspace server dev",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "",
"main": "code.js",
"scripts": {
"build": "NODE_ENV=production webpack --mode=production && rm ./Figma\\ Chat/ui.js*",
"build": "NODE_ENV=production webpack --mode=production && rm ../../release/Figma\\ Chat/ui.js ../../release/Figma\\ Chat/ui.js.LICENSE.txt",
"lint": "eslint --ext .tsx,.ts,.json,.js src/ --fix",
"start": "DEBUG=* webpack --watch"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports = (env, argv) => ({
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, figmaPlugin.name),
path: path.resolve(__dirname, '..', '..', 'release', figmaPlugin.name),
},
plugins: [
// argv.mode !== 'production' ? new BundleAnalyzerPlugin() : null,
Expand Down Expand Up @@ -109,7 +109,7 @@ module.exports = (env, argv) => ({
`,
}),
new CreateFileWebpack({
path: path.resolve(__dirname, figmaPlugin.name),
path: path.resolve(__dirname, '..', '..', 'release', figmaPlugin.name),
fileName: 'manifest.json',
content: JSON.stringify(figmaPlugin),
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"outDir": "dist"
"outDir": "../../release/server"
},
"include": ["src"]
}
55 changes: 35 additions & 20 deletions packages/web/config-overrides.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,43 @@
const PnpWebpackPlugin = require('pnp-webpack-plugin');
const path = require('path');

module.exports = function override(webpackConfig, env) {
// const tsRule = webpackConfig.module.rules[1].oneOf[2];
// tsRule.include = undefined;
// tsRule.exclude = /node_modules/;
module.exports = {
paths: function (paths, env) {
paths.appBuild = path.join(
paths.appBuild,
'..',
'..',
'..',
'release',
'web'
);
return paths;
},
webpack: (webpackConfig, env) => {
// const tsRule = webpackConfig.module.rules[1].oneOf[2];
// tsRule.include = undefined;
// tsRule.exclude = /node_modules/;

webpackConfig.module.rules.push({
test: /\.tsx?$/,
loader: require.resolve('ts-loader'),
options: {
transpileOnly: true,
},
});
webpackConfig.module.rules.push({
test: /\.tsx?$/,
loader: require.resolve('ts-loader'),
options: {
transpileOnly: true,
},
});

webpackConfig.resolve.plugins = webpackConfig.resolve.plugins.filter(
({ constructor }) => {
if (!constructor) return true;
return constructor.name !== 'ModuleScopePlugin';
}
);
webpackConfig.resolve.plugins = webpackConfig.resolve.plugins.filter(
({ constructor }) => {
if (!constructor) return true;
return constructor.name !== 'ModuleScopePlugin';
}
);

webpackConfig.resolve.plugins.unshift(PnpWebpackPlugin);
webpackConfig.resolve.plugins.unshift(PnpWebpackPlugin.moduleLoader(module));
webpackConfig.resolve.plugins.unshift(PnpWebpackPlugin);
webpackConfig.resolve.plugins.unshift(
PnpWebpackPlugin.moduleLoader(module)
);

return webpackConfig;
return webpackConfig;
},
};

0 comments on commit 3b24cda

Please sign in to comment.