Move to npm and update lock-file

This commit is contained in:
Linus Unnebäck 2018-06-19 11:06:29 +01:00
Родитель bbfd0ea67a
Коммит ec9bd1f88b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CE70CEAE9C0FA66F
8 изменённых файлов: 2823 добавлений и 13977 удалений

Просмотреть файл

@ -1,24 +1,23 @@
language: node_js
sudo: false
node_js:
- '8'
- '10'
- '8'
- '10'
script:
- yarn run test-ci
- npm run test-ci
- node bin/build-locales
- yarn run build
- yarn run lint
- npm run build
- npm run lint
# run integration tests using an addons-linter binary in a production-like environment
- yarn run test-integration:production
- npm run test-integration:production
notifications:
irc:
channels:
- irc.mozilla.org#amo-bots
on_success: change
on_failure: always
after_script: yarn run publish-coverage
after_script: npm run publish-coverage
cache:
yarn: true
directories:
- node_modules
deploy:
@ -31,7 +30,7 @@ deploy:
tags: true
repo: mozilla/addons-linter
branch: master
after_success: yarn run publish-rules > /dev/null 2>&1
after_success: npm run publish-rules > /dev/null 2>&1
env:
global:
- secure: kxnTz51/kPI6y4vU8y222rX1B0csVWXU3pvJVzKxgBuoOtvSsebqsjPXkBT67j0anf7yg/N9qIFXf/8J2QWOAs3mYS0viONppGsiAUqla9QwpEJG89equl/760J5RIiSswsMTI/Rd1CM53AF7lUudF5+htXt9VkWvOAbJzkCTAdsqJZgNIQYDezkRxEwpmaIVZNzh/wsjW7x8as4sAeq3qZeVGRA6skEJiOIoR780EFOQqVz+BH+17NreFFM60ekkLBTzjCjkRyWCZmNl8FMz/F/E3qN/21y6ggqfBJf9qGO9GJ3xAr5FhGmyllMP4xKyQeBlUkbzJHWFnAvJFOQ+4dlVech9X3RFczQwMpnVT/m6rQyYy7xQXw+2f6iiAXf4biPsWJgEOBuJwgNIIGAWTbxvH7k5xa5iDbKFntw0TIzAopNZI6JBd5kUQHri0544q2akHRZzcpa+0ZBqOiqMMoL3pkws2L8E8VYKofL3vmP/2o298Ah0KYZWsl6Oc5Ev/vfQLn+cGROpgoeoURW601kFpJ4+uLNhQwdxavEI0KnRLK9OZKik0mHzy/LX/xp6aKl1jREc04pONzSHqQtkhSLmjauQoF0e6UXWCPdH4LW1bd1Xw0BhvyOjSiy2gOyRfj9WHunn9pb4oDsYQbswDIlew6wQR6uKoc7d7/rUDI=

Просмотреть файл

@ -19,23 +19,21 @@ You need node.js to use the add-ons linter.
To validate your add-on locally, install the linter from
[npm](http://nodejs.org/):
```
```sh
# Install globally so you can use the linter from any directory on
# your machine.
yarn global add addons-linter
# or
npm install -g addons-linter
```
After installation, run the linter and direct it to your add-on file:
```
```sh
addons-linter my-addon.zip
```
Alternatively you can point it at a directory:
```
```sh
addons-linter my/package/dir
```
@ -43,7 +41,7 @@ The addons-linter will check your add-on and show you errors, warnings,
and friendly messages for your add-on. If you want more info on the options
you can enable/disable for the command-line app, use the `--help` option:
```
```sh
addons-linter --help
```
@ -113,11 +111,11 @@ pretty easy to get started, you just need node.js installed on your machine.
If you have node.js installed, here's the quick start to getting
your development dependencies installed and building the binary:
```
```sh
git clone https://github.com/mozilla/addons-linter.git
cd addons-linter
yarn install
yarn start
npm install
npm start
# Leave running to watch for changes or cancel to stop watching.
bin/addons-linter my-addon.zip
```
@ -130,37 +128,35 @@ easiest way to manage multiple node versions side by side. See
### Install dependencies
Install dependencies with [yarn](https://yarnpkg.com/lang/en/docs/install/):
Install dependencies with npm:
```
yarn install
```sh
npm install
```
Dependencies are automatically kept up-to-date using [greenkeeper](http://greenkeeper.io/).
#### yarn scripts
#### npm scripts
Most of these scripts will also run with npm by substuting `yarn` with `npm`.
| Script | Description |
|------------------------|----------------------------------------------------|
| yarn test | Runs the tests |
| yarn test-coverage | Runs the tests with coverage (watches for changes) |
| yarn test | Runs the tests once |
| yarn lint | Runs eslint |
| yarn test-coverage-once| Runs the tests once with coverage |
| yarn start | Builds the lib and watches for changes |
| yarn [run] build | Builds the lib (used by Travis) |
| Script | Description |
|-----------------------|----------------------------------------------------|
| npm test | Runs the tests |
| npm test-coverage | Runs the tests with coverage (watches for changes) |
| npm test | Runs the tests once |
| npm lint | Runs eslint |
| npm test-coverage-once| Runs the tests once with coverage |
| npm start | Builds the lib and watches for changes |
| npm [run] build | Builds the lib (used by Travis) |
### Building and watching for changes
You can run `yarn start` to build the library and then rebuild on file changes.
You can run `npm start` to build the library and then rebuild on file changes.
Once you build the library you can use the CLI in `bin/addons-linter`.
### Testing
Run `yarn test` or `npm test`.
Run `npm test`.
#### Coverage
@ -215,7 +211,6 @@ We use [bunyan](https://github.com/trentm/node-bunyan) for logging:
pipe anything that logs into `bunyan` e.g. `LOG_LEVEL=debug jest test
| node_modules/bunyan/bin/bunyan`
## Architecture
In a nutshell the way the linter works is to take an add-on

Просмотреть файл

@ -5,7 +5,9 @@ install:
- ps: Install-Product node $env:nodejs_version x64
- set CI=true
- set PATH=%APPDATA%\npm;%PATH%
- yarn install
# Node.js 8 comes with an npm that doesn't support "npm ci"
- IF %nodejs_version% EQU 8 npm install -g npm@^5.7.1
- npm ci
matrix:
fast_finish: true
@ -22,13 +24,12 @@ environment:
test_script:
- node --version
- npm --version
- yarn --version
### This npm script will execute the same tests executed by test-ci
### but it skips coveralls (which is not currently recognized when
### used from appveyor).
- yarn run test-coverage-once
- npm run test-coverage-once
### Building the dist file is needed by the linting step.
- yarn run build
- yarn run lint
- npm run build
- npm run lint
# run integration tests using an addons-linter binary in a production-like environment
- yarn run test-integration:production
- npm run test-integration:production

Просмотреть файл

@ -14,7 +14,7 @@ try {
} catch (err) {
if (err.code === 'MODULE_NOT_FOUND') {
console.log('You did not build addons-linter yet.');
console.log('Please run `yarn` and `yarn build` or see README.md for more information.');
console.log('Please run `npm install` and `npm run build` or see README.md for more information.');
process.exitCode = 1;
return;

8047
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -35,6 +35,43 @@
"url": "https://github.com/mozilla/addons-linter/issues"
},
"homepage": "https://github.com/mozilla/addons-linter#readme",
"dependencies": {
"ajv": "6.5.1",
"ajv-merge-patch": "3.0.0",
"babel-register": "6.26.0",
"chalk": "2.4.0",
"cheerio": "1.0.0-rc.2",
"columnify": "1.5.4",
"common-tags": "1.8.0",
"crx-parser": "0.1.2",
"deepmerge": "2.1.1",
"dispensary": "0.19.0",
"es6-promisify": "5.0.0",
"eslint": "4.19.1",
"eslint-plugin-no-unsafe-innerhtml": "1.0.16",
"esprima": "3.1.3",
"first-chunk-stream": "2.0.0",
"fluent-syntax": "^0.7.0",
"glob": "7.1.2",
"is-mergeable-object": "1.1.0",
"jed": "1.1.1",
"os-locale": "2.1.0",
"pino": "5.0.0-rc.4",
"po2json": "0.4.5",
"postcss": "6.0.19",
"probe-image-size": "4.0.0",
"relaxed-json": "1.0.1",
"semver": "5.5.0",
"shelljs": "0.8.1",
"source-map-support": "0.5.6",
"strip-bom-stream": "3.0.0",
"tosource": "1.0.0",
"upath": "1.1.0",
"whatwg-url": "6.5.0",
"xmldom": "0.1.27",
"yargs": "11.0.0",
"yauzl": "2.9.2"
},
"devDependencies": {
"babel-core": "6.26.0",
"babel-eslint": "8.2.2",
@ -80,42 +117,5 @@
"webpack": "4.12.0",
"webpack-cli": "3.0.8"
},
"dependencies": {
"ajv": "6.5.1",
"ajv-merge-patch": "3.0.0",
"babel-register": "6.26.0",
"chalk": "2.4.0",
"cheerio": "1.0.0-rc.2",
"columnify": "1.5.4",
"common-tags": "1.8.0",
"crx-parser": "0.1.2",
"deepmerge": "2.1.1",
"dispensary": "0.19.0",
"es6-promisify": "5.0.0",
"eslint": "4.19.1",
"eslint-plugin-no-unsafe-innerhtml": "1.0.16",
"esprima": "3.1.3",
"first-chunk-stream": "2.0.0",
"fluent-syntax": "^0.7.0",
"glob": "7.1.2",
"is-mergeable-object": "1.1.0",
"jed": "1.1.1",
"os-locale": "2.1.0",
"pino": "5.0.0-rc.4",
"po2json": "0.4.5",
"postcss": "6.0.19",
"probe-image-size": "4.0.0",
"relaxed-json": "1.0.1",
"semver": "5.5.0",
"shelljs": "0.8.1",
"source-map-support": "0.5.6",
"strip-bom-stream": "3.0.0",
"tosource": "1.0.0",
"upath": "1.1.0",
"whatwg-url": "6.5.0",
"xmldom": "0.1.27",
"yargs": "11.0.0",
"yauzl": "2.9.2"
},
"snyk": true
}

Просмотреть файл

@ -32,16 +32,31 @@ function spawnWithShell(cmd, args, options) {
return spawn(cmd, args, Object.assign({}, baseSpawnOptions, options));
}
function createPackage(archiveFilePath) {
function getPackedName() {
return new Promise((resolve, reject) => {
fs.readFile('package.json', (err, data) => {
if (err) {
reject(err);
} else {
const info = JSON.parse(data.toString());
resolve(`${info.name}-${info.version}.tgz`);
}
});
});
}
function createPackage(tmpDirPath) {
console.log(chalk.green('Create a pre-release npm package archive'));
return new Promise((resolve, reject) => {
const pkgPack = spawnWithShell('yarn', ['pack', '--filename', archiveFilePath]);
const pkgPack = spawnWithShell('npm', ['pack', process.cwd()], { cwd: tmpDirPath });
pkgPack.stdout.pipe(process.stdout);
pkgPack.stderr.pipe(process.stderr);
pkgPack.on('close', (exitCode) => {
if (exitCode === 0) {
resolve();
resolve(getPackedName().then((filename) => {
return path.join(tmpDirPath, filename);
}));
} else {
reject(new Error('Failed to create npm package archive'));
}
@ -64,7 +79,7 @@ function unpackTarPackage(packagePath, destDir) {
function installPackageDeps(packageDir) {
console.log(chalk.green('Install production package dependencies'));
return new Promise((resolve, reject) => {
const pkgInstall = spawnWithShell('yarn', ['install', '--production', '--no-lockfile'], {
const pkgInstall = spawnWithShell('npm', ['install', '--production', '--no-lockfile'], {
cwd: packageDir,
});
pkgInstall.stdout.pipe(process.stdout);
@ -82,11 +97,11 @@ function installPackageDeps(packageDir) {
function runIntegrationTests(packageDir) {
console.log(chalk.green('Running integration tests in production-like environent'));
return new Promise((resolve, reject) => {
const testRun = spawnWithShell('yarn', ['run', npmScript, '--', jestTestsPath], {
env: {
const testRun = spawnWithShell('npm', ['run', npmScript, '--', jestTestsPath], {
env: Object.assign({}, process.env, {
PATH: process.env.PATH,
TEST_BIN_PATH: path.join(packageDir, 'bin'),
},
}),
});
testRun.stdout.pipe(process.stdout);
@ -105,11 +120,10 @@ function runIntegrationTests(packageDir) {
// and then run the integration tests on it.
tmp.withDir((tmpDir) => {
const tmpDirPath = tmpDir.path;
const archiveFilePath = path.join(tmpDirPath, 'pre-release-package.tar.gz');
const unpackedDirPath = path.join(tmpDirPath, 'package');
return createPackage(archiveFilePath)
.then(() => unpackTarPackage(archiveFilePath, tmpDirPath))
return createPackage(tmpDirPath)
.then((archiveFilePath) => unpackTarPackage(archiveFilePath, tmpDirPath))
.then(() => installPackageDeps(unpackedDirPath))
.then(() => runIntegrationTests(unpackedDirPath));
}, tmpOptions).catch((err) => {

8564
yarn.lock

Разница между файлами не показана из-за своего большого размера Загрузить разницу