Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
Merge pull request #331 from MoOx/fix/323
Browse files Browse the repository at this point in the history
Ensure .gitignore when setup a new boilerplate
  • Loading branch information
MoOx committed Mar 21, 2016
2 parents 13ad6f2 + 4aadc7d commit c318d05
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
1 change: 1 addition & 0 deletions boilerplate/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
*.log
21 changes: 20 additions & 1 deletion npm/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
17 changes: 5 additions & 12 deletions src/bin/commands/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 = {
Expand All @@ -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(
Expand Down

0 comments on commit c318d05

Please sign in to comment.