diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f222e275..e45a7317b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.9.1 - 2016-03-21 + +- Fixed: default boilerplate have a correct .gitignore file (not .npmignore) + ([#323](https://github.com/MoOx/statinamic/issues/323)) + # 0.9.0 - 2016-03-21 → [Example of update from 0.8 to 0.9](https://github.com/putaindecode/putaindecode.io/commit/4eea549?w=1) diff --git a/boilerplate/.gitignore b/boilerplate/.gitignore index f06235c46..d4d7e3f61 100644 --- a/boilerplate/.gitignore +++ b/boilerplate/.gitignore @@ -1,2 +1,3 @@ node_modules dist +*.log diff --git a/npm/postinstall.js b/npm/postinstall.js index e047c35b8..f108e1bbc 100644 --- a/npm/postinstall.js +++ b/npm/postinstall.js @@ -2,12 +2,31 @@ const stat = require("fs").stat const spawn = require("child_process").spawn const join = require("path").join const pkg = require("../package.json") - +const fs = require("fs-extra") // no need for th is step on CI if (process.env.CI) { process.exit(0) } +const boilerplateDir = join(__dirname, "../boilerplate") + +stat(join(boilerplateDir, ".npmignore"), function(err) { + if (err) { + console.log("No .npmignore in boilerplate to rename") + return true + } + + fs.move( + join(boilerplateDir, ".npmignore"), + join(boilerplateDir, ".gitignore"), + function(err) { + if (err) { + throw new Error("Cannot rename .npmignore to .gitignore in boilerplate") + } + } + ) +}) + stat("lib", function(error, stats1) { if (!error && stats1.isDirectory()) { return true diff --git a/package.json b/package.json index f8590a406..aa7bdbc36 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "statinamic", - "version": "0.9.0", + "version": "0.9.1", "description": "A static website generator to create dynamic website using React components.", "keywords": [ "react", diff --git a/src/bin/commands/setup.js b/src/bin/commands/setup.js index 96463193e..8f95e8db1 100644 --- a/src/bin/commands/setup.js +++ b/src/bin/commands/setup.js @@ -2,7 +2,7 @@ import "babel-polyfill" import color from "chalk" import { join } from "path" -import fs from "fs-extra" +import fs from "fs-promise" import { prompt } from "../utils/inquirer" import questions, { defaultTestAnswers } from "../data/questions" @@ -15,17 +15,10 @@ import { export default async function setup(argv) { const cwd = process.cwd() + const testMode = argv.test try { - let answers - const testMode = argv.test - - if (testMode) { - answers = defaultTestAnswers - } - else { - answers = await prompt(questions) - } + const answers = testMode ? defaultTestAnswers : await prompt(questions) const { name, homepage, ...statinamic } = answers const devDependencies = { @@ -44,11 +37,11 @@ export default async function setup(argv) { devDependencies, } - fs.writeJsonSync(join(cwd, "package.json"), pkg) + await fs.writeJson(join(cwd, "package.json"), pkg) console.log(color.green("Generated package.json file")) const boilerplatePath = join(__dirname, "../../../boilerplate") - fs.copySync(boilerplatePath, cwd) + await fs.copy(boilerplatePath, cwd) console.log(color.green("Copied boilerplate")) console.log(