Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create-workflow-home@2.0.0 generates invalid workflow-home #163

Closed
havardh opened this issue Sep 18, 2018 · 1 comment
Closed

create-workflow-home@2.0.0 generates invalid workflow-home #163

havardh opened this issue Sep 18, 2018 · 1 comment

Comments

@havardh
Copy link
Owner

havardh commented Sep 18, 2018

How to reproduce

Create a new workflow-home

npx create-workflow-home@latest .workflow-home

Run the --help command in the newly created workflow-home

 $ workflow --config .workflow-home/config.js --help

Expected

The help text of workflow

Actual

The error message


/home/havard/.workflow-new/config.js:40
    wm: new WorkflowWm(),
        ^

TypeError: WorkflowWm is not a constructor
    at Object.<anonymous> (/home/havard/.workflow-new/config.js:40:9)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/havard/.nvm/versions/node/v8.9.0/lib/node_modules/workflow/node_modules/workflow-cmd/dist/index.js:129:30)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/havard/.nvm/versions/node/v8.9.0/lib/node_modules/workflow/node_modules/workflow-cmd/index.js:9:3)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)

Workaround

Replace the named import WorkflowWm and the constructor invocation with the name of the export from the appropriate wm package.

e.g.

/* eslint-env node */
const { join } = require("path");
const { WorkflowResolverRelative } = require("workflow-resolver-relative");
const { WorkflowResolverAbsolute } = require("workflow-resolver-absolute");
const { WorkflowLoaderBabel } = require("workflow-loader-babel");
const { WorkflowParserArguments } = require("workflow-parser-arguments");
const {
  WorkflowTransformerApplyArgumentsToFields
} = require("workflow-transformer-apply-arguments-to-fields");
const { WorkflowLayout } = require("workflow-layout");
const { WorkflowWmI3 } = require("workflow-wm-i3");

const config = {
  presets: [
    "flow",
    "react",
    [
      "env",
      {
        targets: {
          node: "current"
        }
      }
    ]
  ],
  plugins: ["transform-object-rest-spread", "transform-class-properties"]
};

module.exports = {
  config: {
    resolvers: [
      new WorkflowResolverAbsolute(),
      new WorkflowResolverRelative({ path: process.cwd() }),
      new WorkflowResolverRelative({ path: join(__dirname, "flows") })
    ],
    loaders: [{ loader: new WorkflowLoaderBabel({ config }) }],
    argumentParser: new WorkflowParserArguments(),
    transformers: [new WorkflowTransformerApplyArgumentsToFields()],
    layout: new WorkflowLayout(),
    wm: new WorkflowWmI3()
  }
};
@havardh
Copy link
Owner Author

havardh commented Sep 19, 2018

Fixed in create-workflow-home@2.0.1

@havardh havardh closed this as completed Sep 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant