GithubHelp home page GithubHelp logo

Comments (3)

AntoninoBonanno avatar AntoninoBonanno commented on June 28, 2024

In tests the paths are not consistent:

path: './test/fixtures',

path: './test/fixtures/complete-theme',

from wordpress.

seebeen avatar seebeen commented on June 28, 2024

Good catch 💪

You are correct, there is an error with a double path resolve, but the path creation and concatenation is proper in this context. Meaning - it should and must work.

path is an undocumented setting added primarily to make testing procedures easier, and maybe to support some advanced workflows in the future. Glad to see your putting it to good use 😊

You can see here

path: './test/fixtures/theme-bad-version',

That the full path to the theme needs to be provided - so it's an error in the config.

Your config:

[
    "@semantic-release/wordpress",
    {
        "type": "theme",
        "slug" : "my-theme",
        "withReadme": true,
        "copyFiles": false,
        "releasePath": "/tmp/wp-release",
        "path": "./dist"
    }
],

Needs to be

[
    "@semantic-release/wordpress",
    {
        "type": "theme",
        "slug" : "my-theme",
        "withReadme": true,
        "copyFiles": false,
        "releasePath": "/tmp/wp-release",
        "path": "./dist/my-theme"
    }
],

And then it should work.

P.S. I corrected the error with the double path.resolve and improved the test case to demonstrate that custom path works

from wordpress.

AntoninoBonanno avatar AntoninoBonanno commented on June 28, 2024

Hi @seebeen, thanks for the immediate response.
I did a test but with this configuration the file verification fails.

[
    "@semantic-release/wordpress",
    {
        "type": "theme",
        "slug" : "my-theme",
        "withReadme": true,
        "copyFiles": false,
        "releasePath": "/tmp/wp-release",
        "path": "./dist/my-theme"
    }
],

i think because inside verify-theme.ts concat path with slug.

? path.resolve(config.path, config.slug)

So the path in verify state is "./dist/my-theme/my-theme" and in prepare state is "./dist/my-theme"

In my case the correct path is "./dist/my-theme".

[5:13:15 PM] [semantic-release] › ✘  ETHEMEFILENOTFOUND Your theme must contain these files: style.css, functions.php
Check if the files exist, and if not create them: style.css, functions.php.
AggregateError: 
    SemanticReleaseError: Your theme must contain these files: style.css, functions.php
        at getError (file:///builds/my-theme/theme/node_modules/@semantic-release/wordpress/dist/utils/get-error.js:5:12)
        at verifyTheme (file:///builds/my-theme/theme/node_modules/@semantic-release/wordpress/dist/utils/verify-theme.js:13:13)
        at async verifyConditions (file:///builds/my-theme/theme/node_modules/@semantic-release/wordpress/dist/verify-conditions.js:12:17)
        at async validator (file:///builds/my-theme/theme/node_modules/semantic-release/lib/plugins/normalize.js:36:24)
        at async file:///builds/my-theme/theme/node_modules/semantic-release/lib/plugins/pipeline.js:38:36
        at async Promise.all (index 0)
        at async next (file:///builds/my-theme/theme/node_modules/semantic-release/node_modules/p-reduce/index.js:15:44)
    at file:///builds/my-theme/theme/node_modules/semantic-release/lib/plugins/pipeline.js:55:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async pluginsConfigAccumulator.<computed> [as verifyConditions] (file:///builds/my-theme/theme/node_modules/semantic-release/lib/plugins/index.js:87:11)
    at async run (file:///builds/my-theme/theme/node_modules/semantic-release/index.js:106:3)
    at async Module.default (file:///builds/my-theme/theme/node_modules/semantic-release/index.js:275:22)
    at async default (file:///builds/my-theme/theme/node_modules/semantic-release/cli.js:55:5) {
  errors: [
    SemanticReleaseError: Your theme must contain these files: style.css, functions.php
        at getError (file:///builds/my-theme/theme/node_modules/@semantic-release/wordpress/dist/utils/get-error.js:5:12)
        at verifyTheme (file:///builds/my-theme/theme/node_modules/@semantic-release/wordpress/dist/utils/verify-theme.js:13:13)
        at async verifyConditions (file:///builds/my-theme/theme/node_modules/@semantic-release/wordpress/dist/verify-conditions.js:12:17)
        at async validator (file:///builds/my-theme/theme/node_modules/semantic-release/lib/plugins/normalize.js:36:24)
        at async file:///builds/my-theme/theme/node_modules/semantic-release/lib/plugins/pipeline.js:38:36
        at async Promise.all (index 0)
        at async next (file:///builds/my-theme/theme/node_modules/semantic-release/node_modules/p-reduce/index.js:15:44) {
      code: 'ETHEMEFILENOTFOUND',
      details: 'Check if the files exist, and if not create them: style.css, functions.php.',
      semanticRelease: true,
      pluginName: '@semantic-release/wordpress'
    }
  ]

For test this user case, the prepare.specs.ts and verify-theme.spec.ts must have the same options

{
      type: 'theme',
      slug: 'complete-theme',
      path: './test/fixtures/complete-theme',
      copyFiles: false,
}

from wordpress.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.