milkee 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +11 -13
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Generated by CoffeeScript 2.7.0
2
2
  (function() {
3
- var CONFIG_FILE, CONFIG_PATH, CWD, TEMPLATE_PATH, argv, compile, consola, exec, fs, hideBin, path, pkg, setup, yargs;
3
+ var CONFIG_FILE, CONFIG_PATH, CWD, argv, compile, consola, exec, fs, hideBin, path, pkg, setup, yargs;
4
4
 
5
5
  yargs = require('yargs');
6
6
 
@@ -22,35 +22,33 @@
22
22
 
23
23
  CONFIG_PATH = path.join(CWD, CONFIG_FILE);
24
24
 
25
- TEMPLATE_PATH = path.join(__dirname, '..', 'temp', 'coffee.config.js');
26
-
27
25
  setup = function() {
28
- var error;
26
+ var CONFIG_TEMPLATE, TEMPLATE_PATH, error;
29
27
  if (fs.existsSync(CONFIG_PATH)) {
30
28
  consola.warn(`\`${CONFIG_FILE}\` already exists in this directory.`);
31
29
  return;
32
30
  }
33
31
  try {
32
+ TEMPLATE_PATH = path.join(__dirname, '..', 'temp', 'coffee.config.js');
33
+ CONFIG_TEMPLATE = fs.readFileSync(TEMPLATE_PATH, 'utf-8');
34
34
  fs.writeFileSync(CONFIG_PATH, CONFIG_TEMPLATE);
35
35
  return consola.success(`Successfully created \`${CONFIG_FILE}\`.`);
36
36
  } catch (error1) {
37
37
  error = error1;
38
- return consola.error(`Failed to create \`${CONFIG_FILE}\`:`, error);
38
+ consola.error(`Failed to create \`${CONFIG_FILE}\`:`, error);
39
+ return consola.info(`Template file may be missing from the package installation at \`${TEMPLATE_PATH}\``);
39
40
  }
40
41
  };
41
42
 
42
- compile = async(async function() {
43
- var command, commandParts, config, configPathUrl, error, key, options, otherOptionStrings, value;
43
+ compile = function() {
44
+ var command, commandParts, config, error, key, options, otherOptionStrings, value;
44
45
  if (!fs.existsSync(CONFIG_PATH)) {
45
- consola.error(`\`${CONFIG_FILE}\` not found.`);
46
+ consola.error(`\`${CONFIG_FILE}\` not found in this directory: ${CWD}`);
46
47
  consola.info('Please run `milkee --setup` to create a configuration file.');
47
48
  process.exit(1);
48
49
  }
49
50
  try {
50
- configPathUrl = path.toFileUrl(CONFIG_PATH).href;
51
- ({
52
- default: config
53
- } = (await import(configPathUrl)));
51
+ config = require(CONFIG_PATH);
54
52
  if (!(config.entry && config.output)) {
55
53
  consola.error('`entry` and `output` properties are required in your configuration.');
56
54
  process.exit(1);
@@ -104,7 +102,7 @@
104
102
  consola.error('Failed to load or execute configuration:', error);
105
103
  return process.exit(1);
106
104
  }
107
- });
105
+ };
108
106
 
109
107
  argv = yargs(hideBin(process.argv)).scriptName('milkee').usage('$0 [command]').option('setup', {
110
108
  alias: 's',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "milkee",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "A simple CoffeeScript build tool with coffee.config.js",
5
5
  "main": "dist/main.js",
6
6
  "bin": {