Skip to content

Commit 5cb0e43

Browse files
committed
Use and support ESM
1 parent e7323f7 commit 5cb0e43

62 files changed

Lines changed: 5906 additions & 4463 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ rules:
5858
comma-style:
5959
- 2
6060
- last
61-
complexity: [1, 9]
6261
computed-property-spacing:
6362
- 2
6463
- never

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env node
22

3-
require('./lib');
3+
import './src/index.js';

package-lock.json

Lines changed: 5423 additions & 4133 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.5.11",
44
"description": "Production Quality Meteor Deployments",
55
"main": "lib/index.js",
6+
"type": "module",
67
"repository": {
78
"type": "git",
89
"url": "git+https://github.com/zodern/meteor-up.git"
@@ -22,13 +23,10 @@
2223
"mup": "./index.js"
2324
},
2425
"scripts": {
25-
"prepare": "npm run build -s",
26-
"build": "babel src --out-dir lib --copy-files --source-maps",
27-
"build:watch": "npm run build -s -- -w",
2826
"test": "node ./tests/run.js",
29-
"test:module": "mocha --require @babel/register",
27+
"test:module": "mocha",
3028
"test:parallel": "bash ./tests/run-parallel.sh",
31-
"test:unit": "cross-env NODE_ENV=test nyc --all mocha --require @babel/register src/**/*.unit.js",
29+
"test:unit": "cross-env NODE_ENV=test nyc --all mocha src/**/*.unit.js",
3230
"lint": "npm run lint:code && npm run lint:defaultConfig && npm run lint:readme && npm run lint:css && npm run lint:docs-configs",
3331
"lint:defaultConfig": "eslint --ext=\".sample\" -c .eslintrc.yml --rule=\"comma-dangle: 0\" .",
3432
"lint:code": "eslint .",
@@ -40,38 +38,31 @@
4038
"clean-shrinkwrap": "cd tests && node clean-shrinkwrap.js"
4139
},
4240
"devDependencies": {
43-
"@babel/cli": "^7.25.7",
44-
"@babel/core": "^7.25.7",
45-
"@babel/plugin-proposal-class-properties": "^7.18.6",
46-
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
47-
"@babel/plugin-transform-modules-commonjs": "^7.25.7",
48-
"@babel/register": "^7.25.7",
49-
"babel-eslint": "^10.1.0",
50-
"babel-plugin-istanbul": "^6.0.0",
5141
"chai": "^4.2.0",
52-
"chai-string": "^1.5.0",
42+
"chai-string": "^1.6.0",
5343
"cross-env": "^6.0.3",
5444
"eslint": "^4.19.1",
5545
"eslint-config-es": "^0.8.12",
56-
"eslint-plugin-babel": "^5.3.1",
5746
"eslint-plugin-markdown": "^1.0.2",
5847
"gfm-code-blocks": "^1.0.0",
5948
"keypair": "^1.0.1",
60-
"mocha": "^6.2.3",
49+
"mocha": "^7.2.0",
6150
"node-forge": "^0.7.1",
6251
"nyc": "^15.0.1",
6352
"sinon": "^7.5.0",
64-
"stylelint": "^16.9.0",
65-
"stylelint-config-standard": "^36.0.1"
53+
"stylelint": "^17.3.0",
54+
"stylelint-config-standard": "^40.0.0"
6655
},
6756
"dependencies": {
6857
"@hapi/joi": "^15.1.1",
6958
"@zodern/nodemiral": "^2.0.0-beta.1",
7059
"axios": "^0.28.1",
60+
"babel-eslint": "^10.1.0",
7161
"bluebird": "^3.7.2",
7262
"boxen": "^4.2.0",
7363
"chalk": "^3.0.0",
74-
"debug": "^4.1.1",
64+
"debug": "^4.4.3",
65+
"eslint-plugin-babel": "^5.3.1",
7566
"expand-tilde": "^2.0.2",
7667
"global-modules": "^2.0.0",
7768
"lodash": "^4.17.21",
@@ -81,11 +72,11 @@
8172
"resolve-from": "^5.0.0",
8273
"shell-escape": "^0.2.0",
8374
"shelljs": "^0.8.5",
84-
"ssh2": "^1.16.0",
75+
"ssh2": "^1.17.0",
8576
"tar": "6.2",
86-
"traverse": "^0.6.6",
77+
"traverse": "^0.6.11",
8778
"uuid": "^7.0.3",
88-
"www-authenticate": "^0.6.2",
79+
"www-authenticate": "^0.6.3",
8980
"yargs": "^15.4.1"
9081
},
9182
"nyc": {

src/__tests__/commands.unit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import registerCommand, { commands, registerCommandOverrides } from '../commands';
1+
import registerCommand, { commands, registerCommandOverrides } from '../commands.js';
22
import assert from 'assert';
33
import sinon from 'sinon';
44

src/__tests__/hooks.unit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { hooks, registerHook } from '../hooks';
1+
import { hooks, registerHook } from '../hooks.js';
22
import assert from 'assert';
33

44
describe('hooks', () => {

src/__tests__/load-plugins.unit.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import modules, { locatePluginDir } from '../load-plugins';
2-
import { expect } from 'chai';
1+
import modules, { locatePluginDir } from '../load-plugins.js';
2+
import chai from 'chai';
3+
4+
const { expect } = chai;
35

46
describe('load-plugins', () => {
57
it('should load included plugins', () => {

src/__tests__/plugin-api.unit.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
import * as validate from '../validate';
2-
import { commands } from '../commands';
3-
import { expect } from 'chai';
1+
import * as validate from '../validate/index.js';
2+
import chai from 'chai';
3+
import { commands } from '../commands.js';
4+
import { fileURLToPath } from 'url';
45
import fs from 'fs';
5-
import { hooks } from '../hooks';
6+
import { hooks } from '../hooks.js';
67
import path from 'path';
7-
import PluginAPI from '../plugin-api';
8+
import PluginAPI from '../plugin-api.js';
89
import sinon from 'sinon';
910

11+
const { expect } = chai;
12+
13+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
14+
1015
describe('PluginAPI', () => {
1116
let api;
1217
const base = path.join(__dirname, '../../tests/fixtures/project-unit-tests');
@@ -131,25 +136,27 @@ describe('PluginAPI', () => {
131136
});
132137

133138
describe('validateConfig', () => {
134-
const errors = { errors: ['error1', 'error2'], depreciations: [] };
135-
let validatorStub;
136139
let totalConsoleOutput = '';
137140
let consoleStub;
141+
let oldMongoValidator = validate._pluginValidators.mongo;
138142

139143
beforeEach(() => {
140144
totalConsoleOutput = '';
141-
validatorStub = sinon.stub(validate, 'default').returns(errors);
142145
consoleStub = sinon.stub(console, 'log').callsFake((...text) => {
143146
totalConsoleOutput += text.join(' ');
144147
});
145148
});
146149

147150
afterEach(() => {
148-
validatorStub.restore();
149151
consoleStub.restore();
152+
validate._pluginValidators.mongo = oldMongoValidator;
150153
});
151154

152155
it('should show validation errors', () => {
156+
validate._pluginValidators.mongo = [function() {
157+
return [{ message: 'error1' }, { message: 'error2' }];
158+
}];
159+
153160
api.validateConfig(api.configPath);
154161
consoleStub.restore();
155162

@@ -158,9 +165,6 @@ describe('PluginAPI', () => {
158165
});
159166

160167
it('should show nothing when config is valid', () => {
161-
errors.errors = [];
162-
errors.depreciations = [];
163-
164168
api.validateConfig(api.configPath);
165169

166170
expect(totalConsoleOutput).to.equal('');
@@ -256,7 +260,7 @@ describe('PluginAPI', () => {
256260

257261
it('should update commandHistory', () => {
258262
api.runCommand('test.logs');
259-
expect(api.commandHistory).to.deep.equal([{name: 'test.logs'}]);
263+
expect(api.commandHistory).to.deep.equal([{ name: 'test.logs' }]);
260264
});
261265
});
262266

src/__tests__/prepare-config.unit.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import { _configPreps, registerPreparer, runConfigPreps } from '../prepare-config';
2-
import { expect } from 'chai';
1+
import { _configPreps, registerPreparer, runConfigPreps } from '../prepare-config.js';
2+
import chai from 'chai';
3+
4+
const { expect } = chai;
35

46
describe('prepare-config', () => {
57
beforeEach(() => {

src/__tests__/scrub-config.unit.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import { _configScrubbers, registerScrubber, scrubConfig, utils } from '../scrub-config';
2-
import { expect } from 'chai';
1+
import { _configScrubbers, registerScrubber, scrubConfig, utils } from '../scrub-config.js';
2+
import chai from 'chai';
3+
4+
const { expect } = chai;
35

46
describe('scrub-config', () => {
57
beforeEach(() => {

0 commit comments

Comments
 (0)