Skip to content

Commit

Permalink
remove nscript due to the node-gyp dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviergonz committed Sep 21, 2018
1 parent ed4827f commit 64628aa
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 185 deletions.
225 changes: 108 additions & 117 deletions package.json
@@ -1,120 +1,111 @@
{
"name": "mobx",
"version": "5.1.2",
"description": "Simple, scalable state management.",
"main": "lib/mobx.js",
"umd:main": "lib/mobx.umd.js",
"module": "lib/mobx.module.js",
"unpkg": "lib/mobx.umd.min.js",
"jsnext:main": "lib/mobx.module.js",
"react-native": "lib/mobx.module.js",
"typings": "lib/mobx.d.ts",
"scripts": {
"test": "yarn jest",
"watch": "yarn jest --watch",
"test:mixed-versions": "jest --testRegex mixed-versions",
"test:all": "yarn small-build && yarn jest -i && yarn test:flow && yarn test:mixed-versions",
"test:webpack": "node scripts/webpack-regression-tests.js",
"test:flow": "node_modules/.bin/flow check",
"test:performance": "npm run small-build && PERSIST=true time node --expose-gc test/perf/index.js",
"test:travis": "yarn test:all && yarn test:performance && yarn test -i --coverage && yarn test:webpack && yarn size",
"prettier": "prettier --write --print-width 100 --tab-width 4 --no-semi \"**/*.js\" \"**/*.jsx\" \"**/*.tsx\" \"**/*.ts\"",
"_prepublish": "npm run small-build",
"quick-build": "tsc --pretty",
"small-build": "node scripts/build.js",
"lint": "tslint -c tslint.json src/*.ts src/types/*.ts src/api/*.ts src/core/*.ts src/utils/*.ts",
"size": "size-limit --babili 20KB lib/mobx.js",
"precommit": "lint-staged"
},
"repository": {
"type": "git",
"url": "https://github.com/mobxjs/mobx.git"
},
"author": "Michel Weststrate",
"license": "MIT",
"bugs": {
"url": "https://github.com/mobxjs/mobx/issues"
},
"files": [
"lib",
"LICENSE"
],
"homepage": "https://mobx.js.org/",
"devDependencies": {
"@types/jest": "^21.1.9",
"@types/node": "^7.0.22",
"babel-core": "7.0.0-beta.3",
"babel-jest": "^23.6.0",
"babel-plugin-transform-regenerator": "^6.26.0",
"babel-preset-es2015": "7.0.0-beta.3",
"babel-preset-react": "7.0.0-beta.3",
"babel-preset-stage-1": "7.0.0-beta.3",
"browserify": "^12.0.1",
"chalk": "^1.1.3",
"coveralls": "^2.11.4",
"envify": "^4.1.0",
"flow-bin": "^0.59.0",
"fs-extra": "^3.0.1",
"husky": "^0.14.3",
"iterall": "^1.0.2",
"jest": "^23.6.0",
"lint-staged": "^3.6.1",
"lodash.intersection": "^3.2.0",
"ncp": "^2.0.0",
"nscript": "^0.1.10",
"prettier": "^1.4.4",
"regenerator-runtime": "^0.11.1",
"rollup": "^0.41.6",
"rollup-plugin-filesize": "^1.3.2",
"rollup-plugin-node-resolve": "^3.0.0",
"serializr": "^1.3.0",
"size-limit": "^0.2.0",
"tape": "^4.2.2",
"ts-jest": "^22.0.0",
"tslib": "^1.7.1",
"typescript": "^2.9.0",
"uglify-es": "^3.3.9"
},
"dependencies": {},
"keywords": [
"mobx",
"mobservable",
"observable",
"react-component",
"react",
"reactjs",
"reactive",
"model",
"frp",
"functional-reactive-programming",
"state management",
"data flow"
],
"lint-staged": {
"*.{ts,tsx,js,jsx}": [
"prettier --write --print-width 100 --tab-width 4 --no-semi",
"git add"
]
},
"jest": {
"transform": {
"^.+\\.tsx?$": "ts-jest",
"^.+\\.jsx?$": "babel-jest"
"name": "mobx",
"version": "5.1.2",
"description": "Simple, scalable state management.",
"main": "lib/mobx.js",
"umd:main": "lib/mobx.umd.js",
"module": "lib/mobx.module.js",
"unpkg": "lib/mobx.umd.min.js",
"jsnext:main": "lib/mobx.module.js",
"react-native": "lib/mobx.module.js",
"typings": "lib/mobx.d.ts",
"scripts": {
"test": "yarn jest",
"watch": "yarn jest --watch",
"test:mixed-versions": "jest --testRegex mixed-versions",
"test:all":
"yarn small-build && yarn jest -i && yarn test:flow && yarn test:mixed-versions",
"test:webpack": "node scripts/webpack-regression-tests.js",
"test:flow": "node_modules/.bin/flow check",
"test:performance":
"npm run small-build && PERSIST=true time node --expose-gc test/perf/index.js",
"test:travis":
"yarn test:all && yarn test:performance && yarn test -i --coverage && yarn test:webpack && yarn size",
"prettier":
"prettier --write --print-width 100 --tab-width 4 --no-semi \"**/*.js\" \"**/*.jsx\" \"**/*.tsx\" \"**/*.ts\"",
"_prepublish": "npm run small-build",
"quick-build": "tsc --pretty",
"small-build": "node scripts/build.js",
"lint":
"tslint -c tslint.json src/*.ts src/types/*.ts src/api/*.ts src/core/*.ts src/utils/*.ts",
"size": "size-limit --babili 20KB lib/mobx.js",
"precommit": "lint-staged"
},
"testRegex": "test/base/.*\\.(t|j)sx?$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json"
],
"testPathIgnorePatterns": [
"/node_modules/",
"/\\./"
"repository": {
"type": "git",
"url": "https://github.com/mobxjs/mobx.git"
},
"author": "Michel Weststrate",
"license": "MIT",
"bugs": {
"url": "https://github.com/mobxjs/mobx/issues"
},
"files": ["lib", "LICENSE"],
"homepage": "https://mobx.js.org/",
"devDependencies": {
"@types/jest": "^21.1.9",
"@types/node": "^7.0.22",
"babel-core": "7.0.0-beta.3",
"babel-jest": "^23.6.0",
"babel-plugin-transform-regenerator": "^6.26.0",
"babel-preset-es2015": "7.0.0-beta.3",
"babel-preset-react": "7.0.0-beta.3",
"babel-preset-stage-1": "7.0.0-beta.3",
"browserify": "^12.0.1",
"chalk": "^1.1.3",
"coveralls": "^2.11.4",
"envify": "^4.1.0",
"flow-bin": "^0.59.0",
"fs-extra": "^3.0.1",
"husky": "^0.14.3",
"iterall": "^1.0.2",
"jest": "^23.6.0",
"lint-staged": "^3.6.1",
"lodash.intersection": "^3.2.0",
"ncp": "^2.0.0",
"prettier": "^1.4.4",
"regenerator-runtime": "^0.11.1",
"rollup": "^0.41.6",
"rollup-plugin-filesize": "^1.3.2",
"rollup-plugin-node-resolve": "^3.0.0",
"serializr": "^1.3.0",
"shelljs": "^0.8.2",
"size-limit": "^0.2.0",
"tape": "^4.2.2",
"ts-jest": "^22.0.0",
"tslib": "^1.7.1",
"typescript": "^2.9.0",
"uglify-es": "^3.3.9"
},
"dependencies": {},
"keywords": [
"mobx",
"mobservable",
"observable",
"react-component",
"react",
"reactjs",
"reactive",
"model",
"frp",
"functional-reactive-programming",
"state management",
"data flow"
],
"watchPathIgnorePatterns": [
"<rootDir>/node_modules/"
]
}
}
"lint-staged": {
"*.{ts,tsx,js,jsx}": [
"prettier --write --print-width 100 --tab-width 4 --no-semi",
"git add"
]
},
"jest": {
"transform": {
"^.+\\.tsx?$": "ts-jest",
"^.+\\.jsx?$": "babel-jest"
},
"testRegex": "test/base/.*\\.(t|j)sx?$",
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json"],
"testPathIgnorePatterns": ["/node_modules/", "/\\./"],
"watchPathIgnorePatterns": ["<rootDir>/node_modules/"]
}
}
83 changes: 62 additions & 21 deletions scripts/publish.js
@@ -1,41 +1,82 @@
#!node_modules/.bin/nscript
/* To run this script, nscript is needed: [sudo] npm install -g nscript
/* Publish.js, publish a new version of the npm package as found in the current directory */
/* Run this file from the root of the repository */
module.exports = function(shell, npm, git) {

const shell = require("shelljs")
const fs = require("fs")
const readline = require("readline")

const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
})

function run(command, options) {
const continueOnErrors = options && options.continueOnErrors
const ret = shell.exec(command, options)
if (!continueOnErrors && ret.code !== 0) {
shell.exit(1)
}
return ret
}

function exit(code, msg) {
console.error(msg)
shell.exit(code)
}

async function prompt(question, defaultValue) {
return new Promise(resolve => {
rl.question(`${question} [${defaultValue}]: `, resolve)
})
}

async function main() {
// build
npm("run", "small-build")
run("npm run small-build")

var pkg = JSON.parse(shell.read("package.json"))
const pkg = JSON.parse(fs.readFileSync("package.json", "utf8"))

// Bump version number
var nrs = pkg.version.split(".")
let nrs = pkg.version.split(".")
nrs[2] = 1 + parseInt(nrs[2], 10)
var version = (pkg.version = shell.prompt(
const version = (pkg.version = await prompt(
"Please specify the new package version of '" + pkg.name + "' (Ctrl^C to abort)",
nrs.join(".")
))
if (!version.match(/^\d+\.\d+\.\d+$/)) shell.exit(1, "Invalid semantic version: " + version)
if (!version.match(/^\d+\.\d+\.\d+$/)) {
exit(1, "Invalid semantic version: " + version)
}

// Check registery data
if (npm.silent().test("info", pkg.name)) {
// Check registry data
const npmInfoRet = run(`npm info ${pkg.name} --json`, {
continueOnErrors: true,
silent: true
})
if (npmInfoRet.code === 0) {
//package is registered in npm?
var publishedPackageInfo = JSON.parse(npm.get("info", pkg.name, "--json"))
var publishedPackageInfo = JSON.parse(npmInfoRet.stdout)
if (
publishedPackageInfo.versions == version ||
publishedPackageInfo.versions.indexOf(version) != -1
)
shell.exit(2, "Version " + pkg.version + " is already published to npm")
publishedPackageInfo.versions.includes(version)
) {
exit(2, "Version " + pkg.version + " is already published to npm")
}

shell.write("package.json", JSON.stringify(pkg, null, 2))
fs.writeFileSync("package.json", JSON.stringify(pkg, null, 2), "utf8")

// Finally, commit and publish!
npm("publish")
git("commit", "-am", "Published version " + version)
git("tag", version)
run("npm publish")
run(`git commit -am "Published version ${version}"`)
run(`git tag ${version}`)

git("push")
git("push", "--tags")
run("git push")
run("git push --tags")
console.log("Published!")
} else shell.exit(1, pkg.name + " is not an existing npm package")
} else {
exit(1, pkg.name + " is not an existing npm package")
}
}

main().catch(e => {
throw e
})

0 comments on commit 64628aa

Please sign in to comment.