Skip to content

Commit a949372

Browse files
committed
moves node_modules dir to root #10757
1 parent 292b546 commit a949372

File tree

14 files changed

+81
-81
lines changed

14 files changed

+81
-81
lines changed

.dockerignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ arches/settings_local.pyc
1818
elasticsearch-5.2.1
1919
virtualenv
2020
arches/app/media/packages
21-
arches/app/media/node_modules
21+
node_modules

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ arches/Net_files
2222
.idea
2323
arches/app/media/bower_components
2424
arches/app/media/packages
25-
arches/app/media/node_modules
2625
node_modules
2726
arches/tileserver/cache
2827
docs/_build

.yarnrc

-1
This file was deleted.

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ COPY ./arches/install/package.json ${ARCHES_ROOT}/arches/install/package.json
9090
COPY ./arches/install/.yarnrc ${ARCHES_ROOT}/arches/install/.yarnrc
9191
COPY ./arches/install/yarn.lock ${ARCHES_ROOT}/arches/install/yarn.lock
9292
WORKDIR ${ARCHES_ROOT}/arches/install
93-
RUN mkdir -p ${ARCHES_ROOT}/arches/app/media/node_modules
93+
RUN mkdir -p ${ARCHES_ROOT}/node_modules
9494
RUN yarn install
9595

9696
## Install virtualenv

arches/install/arches-templates/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
*.pyc
22
*.log
3+
node_modules
34
{{ project_name }}/logs
45
{{ project_name }}/export_deliverables
56
{{ project_name }}/cantaloupe/*
67
{{ project_name }}/staticfiles
78
{{ project_name }}/media/packages
8-
{{ project_name }}/media/node_modules
99
{{ project_name }}/media/build/
1010
{{ project_name }}/uploadedfiles/*
1111
{{ project_name }}/settings_local.py

arches/install/arches-templates/.yarnrc

-2
This file was deleted.

arches/install/arches-templates/package.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
"name": "{{ project_name }}",
33
"license": "AGPL-3.0-only",
44
"scripts": {
5-
"build_development": "yarn eslint:check && yarn ts:check && ./{{ project_name }}/media/node_modules/.bin/cross-env NODE_PATH=./{{ project_name }}/media/node_modules NODE_OPTIONS=--max-old-space-size=2048 ./{{ project_name }}/media/node_modules/.bin/webpack --config ./{{ project_name }}/webpack/webpack.config.dev.js",
6-
"build_production": "yarn eslint:check && yarn ts:check && ./{{ project_name }}/media/node_modules/.bin/cross-env NODE_PATH=./{{ project_name }}/media/node_modules NODE_OPTIONS=--max-old-space-size=2048 NODE_ENV=production ./{{ project_name }}/media/node_modules/.bin/webpack --config ./{{ project_name }}/webpack/webpack.config.prod.js",
7-
"build_test": "yarn eslint:check && yarn ts:check && ./{{ project_name }}/media/node_modules/.bin/cross-env NODE_PATH=./{{ project_name }}/media/node_modules NODE_OPTIONS=--max-old-space-size=2048 ./{{ project_name }}/media/node_modules/.bin/webpack --config ./{{ project_name }}/webpack/webpack.config.dev.js --env test=true",
8-
"eslint:check": "./{{ project_name }}/media/node_modules/.bin/eslint ./{{ project_name }}/src --resolve-plugins-relative-to ./{{ project_name }}/media --ext .vue,.ts --parser ./{{ project_name }}/media/node_modules/vue-eslint-parser/index.js",
9-
"eslint:watch": "./{{ project_name }}/media/node_modules/.bin/nodemon --watch ./{{ project_name }}/src --ext ts,vue --exec yarn --silent eslint:check",
10-
"eslint:fix": "./{{ project_name }}/media/node_modules/.bin/eslint ./{{ project_name }}/src --resolve-plugins-relative-to ./{{ project_name }}/media --ext .vue,.ts --parser ./{{ project_name }}/media/node_modules/vue-eslint-parser/index.js --fix",
11-
"gettext:extract": "./{{ project_name }}/media/node_modules/.bin/vue-gettext-extract",
12-
"gettext:compile": "./{{ project_name }}/media/node_modules/.bin/vue-gettext-compile",
13-
"ts:check": "./{{ project_name }}/media/node_modules/.bin/vue-tsc --noEmit",
14-
"ts:watch": "./{{ project_name }}/media/node_modules/.bin/vue-tsc --watch --noEmit",
15-
"start": "./{{ project_name }}/media/node_modules/.bin/cross-env NODE_PATH=./{{ project_name }}/media/node_modules NODE_OPTIONS=--max-old-space-size=2048 ./{{ project_name }}/media/node_modules/.bin/webpack serve --config ./{{ project_name }}/webpack/webpack.config.dev.js"
5+
"build_development": "yarn eslint:check && yarn ts:check && ./node_modules/.bin/cross-env NODE_PATH=./node_modules NODE_OPTIONS=--max-old-space-size=2048 ./node_modules/.bin/webpack --config ./{{ project_name }}/webpack/webpack.config.dev.js",
6+
"build_production": "yarn eslint:check && yarn ts:check && ./node_modules/.bin/cross-env NODE_PATH=./node_modules NODE_OPTIONS=--max-old-space-size=2048 NODE_ENV=production ./node_modules/.bin/webpack --config ./{{ project_name }}/webpack/webpack.config.prod.js",
7+
"build_test": "yarn eslint:check && yarn ts:check && ./node_modules/.bin/cross-env NODE_PATH=./node_modules NODE_OPTIONS=--max-old-space-size=2048 ./node_modules/.bin/webpack --config ./{{ project_name }}/webpack/webpack.config.dev.js --env test=true",
8+
"eslint:check": "./node_modules/.bin/eslint ./{{ project_name }}/src --resolve-plugins-relative-to . --ext .vue,.ts --parser ./node_modules/vue-eslint-parser/index.js",
9+
"eslint:watch": "./node_modules/.bin/nodemon --watch ./{{ project_name }}/src --ext ts,vue --exec yarn --silent eslint:check",
10+
"eslint:fix": "./node_modules/.bin/eslint ./{{ project_name }}/src --resolve-plugins-relative-to . --ext .vue,.ts --parser ./node_modules/vue-eslint-parser/index.js --fix",
11+
"gettext:extract": "./node_modules/.bin/vue-gettext-extract",
12+
"gettext:compile": "./node_modules/.bin/vue-gettext-compile",
13+
"ts:check": "./node_modules/.bin/vue-tsc --noEmit",
14+
"ts:watch": "./node_modules/.bin/vue-tsc --watch --noEmit",
15+
"start": "./node_modules/.bin/cross-env NODE_PATH=./node_modules NODE_OPTIONS=--max-old-space-size=2048 ./node_modules/.bin/webpack serve --config ./{{ project_name }}/webpack/webpack.config.dev.js"
1616
},
1717
"devDependencies": {
1818
"arches-dev-dependencies": "archesproject/arches-dev-dependencies#{{ arches_version }}"

arches/install/arches-templates/project_name/src/declarations.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// import declarations from other projects or Arches core
2-
import('../media/node_modules/arches/arches/app/src/declarations.d.ts');
2+
import('../../node_modules/arches/arches/app/src/declarations.d.ts');
33

44
// declare modules that have been added to your project (should mirror `package.json`)
55
declare module 'arches';

arches/install/arches-templates/project_name/webpack/webpack.common.js

+24-24
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = () => {
3131

3232
const parsedData = JSON.parse(data);
3333
console.log('Data imported from settings.py:', parsedData)
34-
34+
3535
const APP_ROOT = parsedData['APP_ROOT'];
3636
const ARCHES_APPLICATIONS = parsedData['ARCHES_APPLICATIONS'];
3737
const ARCHES_APPLICATIONS_PATHS = parsedData['ARCHES_APPLICATIONS_PATHS'];
@@ -80,9 +80,9 @@ module.exports = () => {
8080
// BEGIN create node modules aliases
8181
const parsedPackageJSONFilepaths = {};
8282

83-
let archesCorePackageJSONFilepath = Path.resolve(__dirname, ROOT_DIR, '../package.json')
83+
let archesCorePackageJSONFilepath = Path.resolve(__dirname, ROOT_DIR, '..', 'package.json')
8484
if (!fs.existsSync(archesCorePackageJSONFilepath)) {
85-
archesCorePackageJSONFilepath = Path.resolve(__dirname, APP_ROOT, 'media', 'node_modules', 'arches', 'package.json')
85+
archesCorePackageJSONFilepath = Path.resolve(__dirname, APP_ROOT, '..', 'node_modules', 'arches', 'package.json')
8686
}
8787

8888
const archesCorePackageJSON = require(archesCorePackageJSONFilepath);
@@ -93,15 +93,15 @@ module.exports = () => {
9393
acc[alias] = Path.resolve(__dirname, ROOT_DIR, 'app', 'media', subPath);
9494
}
9595
else {
96-
acc[alias] = Path.resolve(__dirname, APP_ROOT, 'media', subPath);
96+
acc[alias] = Path.resolve(__dirname, APP_ROOT, '..', subPath);
9797
}
9898
return acc;
9999
}, {});
100100

101101
let parsedProjectNodeModulesAliases = {};
102102
let projectPackageJSON;
103103

104-
const projectJSONFilepath = Path.resolve(__dirname, APP_ROOT, 'package.json');
104+
const projectJSONFilepath = Path.resolve(__dirname, APP_ROOT, '..', 'package.json');
105105
if (fs.existsSync(projectJSONFilepath)) { // handles running Arches without a project
106106
projectPackageJSON = require(projectJSONFilepath);
107107
parsedPackageJSONFilepaths[Path.join(projectPackageJSON.name, 'package.json').replace(/\\/g, '/')] = projectJSONFilepath;
@@ -114,7 +114,7 @@ module.exports = () => {
114114
)
115115
}
116116
else {
117-
acc[alias] = Path.resolve(__dirname, APP_ROOT, 'media', subPath);
117+
acc[alias] = Path.resolve(__dirname, APP_ROOT, '..', subPath);
118118
}
119119
return acc;
120120
}, {});
@@ -130,7 +130,7 @@ module.exports = () => {
130130
archesApplicationJSONFilepath = Path.resolve(__dirname, ARCHES_APPLICATIONS_PATHS[archesApplication], '..', 'package.json');
131131
}
132132
else {
133-
archesApplicationJSONFilepath = Path.resolve(__dirname, APP_ROOT, 'media', 'node_modules', archesApplication, 'package.json')
133+
archesApplicationJSONFilepath = Path.resolve(__dirname, APP_ROOT, '..', 'node_modules', archesApplication, 'package.json')
134134
}
135135

136136
const archesApplicationPackageJSON = require(archesApplicationJSONFilepath);
@@ -148,7 +148,7 @@ module.exports = () => {
148148
)
149149
}
150150
else {
151-
parsedArchesApplicationsNodeModulesAliases[alias] = Path.resolve(__dirname, APP_ROOT, 'media', subPath);
151+
parsedArchesApplicationsNodeModulesAliases[alias] = Path.resolve(__dirname, APP_ROOT, '..', subPath);
152152
}
153153
}
154154
} catch (error) {
@@ -284,9 +284,9 @@ module.exports = () => {
284284
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'false'
285285
}),
286286
new webpack.ProvidePlugin({
287-
$: Path.resolve(__dirname, APP_ROOT, 'media', 'node_modules', 'jquery', 'dist', 'jquery.min'),
288-
jQuery: Path.resolve(__dirname, APP_ROOT, 'media', 'node_modules', 'jquery', 'dist', 'jquery.min'),
289-
jquery: Path.resolve(__dirname, APP_ROOT, 'media', 'node_modules', 'jquery', 'dist', 'jquery.min')
287+
$: Path.resolve(__dirname, APP_ROOT, '..', 'node_modules', 'jquery', 'dist', 'jquery.min'),
288+
jQuery: Path.resolve(__dirname, APP_ROOT, '..', 'node_modules', 'jquery', 'dist', 'jquery.min'),
289+
jquery: Path.resolve(__dirname, APP_ROOT, '..', 'node_modules', 'jquery', 'dist', 'jquery.min')
290290
}),
291291
new MiniCssExtractPlugin(),
292292
new BundleTracker({ filename: Path.resolve(__dirname, `webpack-stats.json`) }),
@@ -298,23 +298,23 @@ module.exports = () => {
298298
}
299299
},
300300
resolve: {
301-
modules: [Path.resolve(__dirname, APP_ROOT, 'media', 'node_modules')],
301+
modules: [Path.resolve(__dirname, APP_ROOT, '..', 'node_modules')],
302302
alias: {
303303
...javascriptRelativeFilepathToAbsoluteFilepathLookup,
304304
...templateFilepathLookup,
305305
...imageFilepathLookup,
306306
...nodeModulesAliases,
307307
...parsedPackageJSONFilepaths,
308308
'@': [Path.resolve(__dirname, APP_ROOT, 'src'), ...archesApplicationsVuePaths, Path.resolve(__dirname, ROOT_DIR, 'app', 'src')],
309-
'node_modules': Path.resolve(__dirname, APP_ROOT, 'media', 'node_modules')
309+
'node_modules': Path.resolve(__dirname, APP_ROOT, '..', 'node_modules')
310310
},
311311
},
312312
module: {
313313
rules: [
314314
{
315315
test: /\.tsx?$/,
316316
exclude: /node_modules/,
317-
loader: Path.join(APP_ROOT, 'media', 'node_modules', 'ts-loader'),
317+
loader: Path.join(APP_ROOT, '..', 'node_modules', 'ts-loader'),
318318
options: {
319319
appendTsSuffixTo: [/\.vue$/],
320320
transpileOnly: true
@@ -323,7 +323,7 @@ module.exports = () => {
323323
{
324324
test: /\.vue$/,
325325
exclude: /node_modules/,
326-
loader:Path.join(APP_ROOT, 'media', 'node_modules', 'vue-loader'),
326+
loader:Path.join(APP_ROOT, '..', 'node_modules', 'vue-loader'),
327327
},
328328
{
329329
test: /\.mjs$/,
@@ -333,10 +333,10 @@ module.exports = () => {
333333
{
334334
test: /\.js$/,
335335
exclude: [/node_modules/, /load-component-dependencies/],
336-
loader: Path.join(APP_ROOT, 'media', 'node_modules', 'babel-loader'),
336+
loader: Path.join(APP_ROOT, '..', 'node_modules', 'babel-loader'),
337337
options: {
338338
presets: ['@babel/preset-env'],
339-
cacheDirectory: Path.join(APP_ROOT, 'media', 'node_modules', '.cache', 'babel-loader'),
339+
cacheDirectory: Path.join(APP_ROOT, '..', 'node_modules', '.cache', 'babel-loader'),
340340
}
341341
},
342342
{
@@ -349,10 +349,10 @@ module.exports = () => {
349349
],
350350
use: [
351351
{
352-
'loader': Path.join(APP_ROOT, 'media', 'node_modules', 'style-loader'),
352+
'loader': Path.join(APP_ROOT, '..', 'node_modules', 'style-loader'),
353353
},
354354
{
355-
'loader': Path.join(APP_ROOT, 'media', 'node_modules', 'css-loader'),
355+
'loader': Path.join(APP_ROOT, '..', 'node_modules', 'css-loader'),
356356
},
357357
],
358358
},
@@ -369,13 +369,13 @@ module.exports = () => {
369369
'loader': MiniCssExtractPlugin.loader,
370370
},
371371
{
372-
'loader': Path.join(APP_ROOT, 'media', 'node_modules', 'css-loader'),
372+
'loader': Path.join(APP_ROOT, '..', 'node_modules', 'css-loader'),
373373
},
374374
{
375-
'loader': Path.join(APP_ROOT, 'media', 'node_modules', 'postcss-loader'),
375+
'loader': Path.join(APP_ROOT, '..', 'node_modules', 'postcss-loader'),
376376
},
377377
{
378-
'loader': Path.join(APP_ROOT, 'media', 'node_modules', 'sass-loader'),
378+
'loader': Path.join(APP_ROOT, '..', 'node_modules', 'sass-loader'),
379379
options: {
380380
sassOptions: {
381381
indentWidth: 4,
@@ -392,7 +392,7 @@ module.exports = () => {
392392
{
393393
test: /\.html?$/i,
394394
exclude: /node_modules/,
395-
loader: Path.join(APP_ROOT, 'media', 'node_modules', 'html-loader'),
395+
loader: Path.join(APP_ROOT, '..', 'node_modules', 'html-loader'),
396396
options: {
397397
esModule: false,
398398
minimize: {
@@ -483,7 +483,7 @@ module.exports = () => {
483483
{
484484
test: /\.(txt|DS_Store)$/i,
485485
exclude: /node_modules/,
486-
use: Path.join(APP_ROOT, 'media', 'node_modules', 'raw-loader'),
486+
use: Path.join(APP_ROOT, '..', 'node_modules', 'raw-loader'),
487487
},
488488
{
489489
test: /\.(png|svg|jpg|jpeg|gif)$/i,

arches/management/commands/build_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def handle(self, *args, **options):
5454

5555
if options["reinstall_node_modules"] == True:
5656
subprocess.call(
57-
'rm -rf ./media/node_modules',
57+
'rm -rf ./node_modules',
5858
shell=True
5959
)
6060
subprocess.call(

arches/settings_utils.py

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ def build_staticfiles_dirs(root_dir, app_root=None, arches_applications=None, ad
2828
if app_root:
2929
directories.append(os.path.join(app_root, "media", "build"))
3030
directories.append(os.path.join(app_root, "media"))
31+
directories.append(
32+
('node_modules', os.path.join(app_root, "..", "node_modules"))
33+
)
3134

3235
if arches_applications:
3336
for arches_application in arches_applications:
@@ -37,6 +40,9 @@ def build_staticfiles_dirs(root_dir, app_root=None, arches_applications=None, ad
3740

3841
directories.append(os.path.join(root_dir, "app", "media", "build"))
3942
directories.append(os.path.join(root_dir, "app", "media"))
43+
directories.append(
44+
('node_modules', os.path.join(root_dir, "..", "node_modules"))
45+
)
4046

4147
return tuple(directories)
4248

0 commit comments

Comments
 (0)